package com.koron.tool;

import java.awt.Component;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class Constant {
	public static final Map<String, String> map = new HashMap<String, String>();
	/**
	 * 代码路径
	 */
	public static final String SRC_ROOT_PATH = "srcRootPath";



	/*
	* 使用的数据库的alias
	* */
	public static final String DATABASE_ALIAS = "databaseAlias";

	public static final String BEAN_PACKAGE = "beanPackage";

	public static final String ANNOTATION_PACKAGE="annotationPackage";

	public static final String MAPPER_PACKAGE = "mapperPackage";

	public static final String DAO_PACKAGE = "daoPackage";

	public static final String SERVICE_PACKAGE = "servicePackage";

	public static final String SEARCH_BEAN_PACKAGE = "searchBeanPackage";

	public static final String VIEW_BEAN_PACKAGE = "viewBeanPackage";

	public static final String XML_FILE_PATH = "xmlFilePath";

	public static final String BASE_SEARCH_BEAN = "baseSearchBean";

	public static final String COMPILE_PATH = "COMPILE_PATH";

	public static final String SRCPATH = "SRCPATH";

	public static final String SERVICE_SRC_PATH="serviceSrcPath";

	public static final String DEVELOPDB = "DEVELOPDB";

	public static final String CODE_SAVE_FLAG = "codeSaveFlag";

	public static final String SERVICE_GENERATE_FLAG = "serviceGenerateFlag";









	/**
	 * 文件编码方式
	 */
	public static final String ENCODE = "encode";

	static{
		map.put(SRC_ROOT_PATH, "代码根路径");
		map.put(DATABASE_ALIAS,"使用的数据库别名");

		map.put(ENCODE, "文件编码方式");

		
	}
	/**
	 * 根据{@link #map}生成表格Render
	 * @return
	 */
	public static final DefaultTableCellRenderer getTableRender()
	{
		return new DefaultTableCellRenderer() {
			@Override
			public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
					int row, int column) {
				String desc = map.get(value);
				if(desc != null)
					return super.getTableCellRendererComponent(table, desc, isSelected, hasFocus, row, column);
				return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
			}
		};
	}
}
